#ifndef VSUSERCONSTANT_H
#define VSUSERCONSTANT_H
#include "VSMemManager.h"
#include "VSMath.h"
#include "VSObject.h"
#include "VSName.h"
namespace VSEngine2
{
class VSStream;
class VSGRAPHIC_API VSUserConstant : public VSObject
{
	//PRIORITY
	
	//RTTI
	DECLARE_RTTI;
	DECLARE_INITIAL
public:
	
	virtual unsigned int DiskUse()const;

	virtual bool Save(VSStream & rStream,unsigned int &iSaveUse)const;
	virtual bool Load(VSStream & rStream,unsigned int &iSaveUse);
public:
	virtual bool Clone(const VSObject *pObject,unsigned int uiType);
	enum //Value Tpye
	{			
		VT_FLOAT,
		VT_BOOL,
		VT_INT,	
		VT_STRUCT,
		VT_MAX
	};
public:
	VSUserConstant(const VSUsedName & Name,const void * pDate,unsigned int uiSize,
		unsigned int uiRegisterIndex,unsigned int uiRegisterNum,unsigned int uiValueType = VT_FLOAT);
	virtual ~VSUserConstant();
	bool SetDate(void *pElementDate);
	inline void* GetDate()const;
	inline unsigned int GetValueType()const;
	inline unsigned int GetSize()const;
	inline unsigned int GetRegisterNum()const;
	inline unsigned int GetRegisterIndex()const;
	inline const VSUsedName & GetName()const
	{
		return m_Name;
	}
	virtual bool PostLoad(void * pDate = NULL);
protected:
	friend class VSRenderer;
	VSUserConstant();

private:
	
	unsigned int m_uiSize;
	unsigned int m_uiValueType;
	unsigned char * m_pDate;
	unsigned int m_uiRegisterIndex;
	unsigned int m_uiRegisterNum;
	VSUsedName m_Name;
};
#include "VSUserConstant.inl"
VSTYPE_MARCO(VSUserConstant);
DECLARE_Ptr(VSUserConstant);
}
#endif